package com.example.administrator.demo_news.utils;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class readInputStream {
    public static String readInputStream(InputStream is) throws IOException {
            ByteArrayOutputStream baos=new ByteArrayOutputStream();
            byte[] buffer=new byte[1024];
            int len=0;
            while ((len=is.read(buffer))!=-1){
                baos.write(buffer,0,len);
            }
            String result=baos.toString();
            is.close();
            baos.close();
            return result;
    }
}
